package ThreadDemo;

public class LeetCode11 {
    public int maxSubArray(int[] nums) {
        int max=Integer.MIN_VALUE;
        for (int i = 1; i < nums.length; i++) {
            if(nums[i-1]>0){
                nums[i]=nums[i-1]+nums[i];
            }else {
                nums[i]=nums[i];
            }
            if(nums[i]>max){
                max=nums[i];
            }
        }
        return max;
    }
}
